#ifndef UTIL_H
#define UTIL_H
#include <vector>
#include <math.h>
#include <iterator>
#include <random>
#include <algorithm>

int generatorData(const int dataNum,std::vector<double>& data,
                  const double& centerX,const double centerY,
                  const double& R)
{
     static std::default_random_engine generator;
     std::normal_distribution<double> dist(0,10);
     double degDiff = 2*M_PI/dataNum;

     std::vector<int> dataIndex;
     for (int var = 0; var < dataNum; ++var) {
        dataIndex.push_back(var);
     }

     std::random_shuffle(dataIndex.begin(),dataIndex.end());
     data.resize(dataNum*2);
     for (int i = 0; i < dataNum; ++i) {
         double x = centerX + cos(i*degDiff)*R + dist(generator);
         double y = centerY - sin(i*degDiff)*R + dist(generator);
         data[dataIndex[i]*2] = x;
         data[dataIndex[i]*2 + 1] = y;
     }

     return 0;
}

#endif // UTIL_H
